import { BasicResp } from './types';
import useHttp from './useHttp';
import type { IPostVerify } from './verifyApi';

export enum MsgType {
  COMMON = 0,
  FIXED = 1,
}

export interface IMsgData {
  id:string;
  username?:string;
  message:string;
  public_time:string;
}

export interface IPostMsgData {
  username?:string;
  message:string;
  verify:Partial<IPostVerify>
}

export const reqLeaveMsg = (currentPage: number = 1, pageSize: number = 10) => {
  return useHttp<BasicResp<IMsgData[]>>({
    url: `msg/getMsgBoardList`,
    method: 'get',
    params:{
      currentPage,
      pageSize
    }
  });
};

export const sendLeaveMsg = (msgValue:IPostMsgData) => {
  return useHttp<BasicResp<String>>({
    url:`msg/addMsgBoard`,
    method:'post',
    data:msgValue
  })
}
